package com.itita.ww2.handler.requesthandler.basemap.util;

import com.smartfoxserver.v2.entities.data.ISFSObject;

/**
 * 基地地图工具类
 * @author NorthLan
 *
 */
public class BaseMapUtil {

	/**
	 * 获取对应建筑的Id(code)
	 */
	public static final String getBuildCode(ISFSObject mapData) {
		return mapData.getUtfString("ID");
	}

	/**
	 *  获取建筑等级
	 */
	public static final int getBuildLevel(ISFSObject mapData) {
		return mapData.getInt("Lv");
	}

	/**
	 *  升级防御建筑
	 */
	public static final int setBuildLevel(ISFSObject mapData, int value) {
		int level = mapData.getInt("Lv");
		level = Math.max(0, level + value);
		mapData.putInt("Lv", level);
		return level;
	}
}
